package 数的范围;

import java.util.Scanner;

public class Main {
    static int N = 100010;
    static int[] a = new int[N];

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        while (m-- > 0) {
            int x = in.nextInt();
            int l = 0, r = n - 1;
            while (l < r) {
                int mid = l + r >> 1;
                if (a[mid] >= x) {
                    r = mid;
                } else {
                    l = mid + 1;
                }
            }
            if (a[l] != x) {
                System.out.println(-1 + " " + -1);
            } else {
                System.out.print(l + " ");
                l = 0;
                r = n - 1;
                while (l < r) {
                    int mid = (l + r + 1) >> 1;
                    if (a[mid] <= x) {
                        l = mid;
                    } else {
                        r = mid - 1;
                    }
                }
                System.out.println(l);
            }
        }
    }
}
